<template>
  <div>
    <input-test v-model="state" :query-search-async="search"></input-test>
  </div>
</template>

<script>
import InputTest from '@/views/demo/InputTest.vue';

export default {
  components: {
    InputTest
  },
  data() {
    return {
      state: "111"
    }
  },
  methods: {
    search(querystr, cb) {
      console.log(22222222222222);
      var restaurants = [
        { "value": "三全鲜食（北新泾店）", "address": "长宁区新渔路144号" },
        { "value": "Hot honey 首尔炸鸡（仙霞路）", "address": "上海市长宁区淞虹路661号" },
        { "value": "新旺角茶餐厅", "address": "上海市普陀区真北路988号创邑金沙谷6号楼113" }
      ];
        var results = querystr ? restaurants.filter(this.createStateFilter(querystr)) : restaurants;
        cb(results);
    },
    createStateFilter(querystr) {
      return (state) => {
        return (state.value.toLowerCase().indexOf(querystr.toLowerCase()) === 0);
      };
    },
  },
}
</script>
